<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet">
    <style>
        .div1 {
            width: 100px;
            height: 100px;
            background-color: rgb(216, 11, 223);
            color: #fff;
            margin-top: 10px;
        }
        
        .div2 {
            width: 200px;
            height: 150px;
            background-color: rgba(8, 70, 90, 0.746);
            color: #fff;
        }
        
        .v-enter {
            opacity: 0;
        }
        
        .v-enter-active {
            transition: opacity 6s;
        }
        
        .v-enter-to {
            opacity: 1;
        }
        
        .v-leave {
            opacity: 1;
        }
        
        .v-leave-acitve {
            transition: opacity 6s;
        }
        
        .v-leave-to {
            opacity: 0;
        }
        /* =========================================== */
        
        .ujiuye-enter {
            width: 10px;
        }
        
        .ujiuye-enter-active {
            transition: width 2s;
        }
        
        .ujiuye-enter-to {
            width: 200px;
        }
        
        .ujiuye-leave {
            width: 200px;
        }
        
        .ujiuye-leave-acitve {
            transition: width 2s;
        }
        
        .ujiuye-leave-to {
            width: 10px;
        }
    </style>
</head>

<body>
    <div id="app">
        <p>vue的过渡效果:使元素的变化更加自然，不生硬</p>
        <p>
            1.添加transition组件，将要添加的过渡代码放到组件中 2.写具体的渐变的CSS代码 3.CSS名是相对固定的:v-enter 、v-enter-active 、v-enter-to 、v-leave 、v-leave-active 、v-leave-to
        </p>
        <button @click='isShow = !isShow'>toggle</button>
        <transition>
            <div v-show='isShow' class="div1">
                我是一段文字
            </div>
        </transition>
        <hr>
        <transition name='ujiuye'>
            <div v-show='isShow' class="div2">
                我是一段文字
            </div>
        </transition>
        <hr>
        <transition leave-active-class='animate__bounceIn' enter-active-class='animate__bounceOut'>
            <div v-show='isShow' class="div2">
                我还是一段文字
            </div>
        </transition>
    </div>
    <script src="./vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                isShow: true
            }
        })
    </script>
</body>

</html>